import { cafReq } from "..";

// export const baseURL =
//   import.meta.env.MODE === "development"
//     ? "/gate"
//     : `${import.meta.env.VITE_REQ_URL}:30020`;
export const baseURL = `${import.meta.env.VITE_FIN_URL}/finance-user`;

// 查询菜单列表
export const listMenu = async (params?: any) => {
  return await cafReq(0, { baseURL }).post("/sys/menu/getAll", params);
};

// 查询菜单详细
export const getMenu = async (menuId?: any) => {
  return await cafReq(0, { baseURL }).get(`/sys/menu/v1/get/${menuId}`);
};

// 查询菜单下拉树结构
export const treeselect = async (parentId?: string) => {
  return await cafReq(0, { baseURL }).post(
    `/sys/menu/getBlowMenus/${parentId}`
  );
};

// 根据角色ID查询菜单下拉树结构
export const roleMenuTreeselect = async (roleId: string, params?: any) => {
  return await cafReq(0, { baseURL }).post(
    `/sys/menu/getBlowMenus/${roleId}`,
    params
  );
};

// 新增菜单
export const addMenu = async (params: any) => {
  return await cafReq(0, { baseURL }).post(`/sys/menu/v1/add`, params);
};

// 修改菜单
export const updateMenu = async (params: any) => {
  return await cafReq(0, { baseURL }).post(`/sys/menu/v1/update`, params);
};

// 删除菜单
export const delMenu = async (businessId: string) => {
  return await cafReq(0, { baseURL }).delete(
    `/sys/menu/v1/delete/${businessId}`
  );
};
